{{include file="common@layout/_meta_x-admin" /}}
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <input type="hidden" name="id" value="{{$storeUser.id}}">
            {{:widget('common/Form/input',['登录名','username',$storeUser.username,true])}}
            {{:widget('common/Form/input',['登录密码','password','',false,false,true])}}
            {{:widget('common/Form/manyInput',[[['lable' => '姓名','name' => 'name','value' => $storeUser.name,'require' => true],['lable' => '手机号','name' => 'phone','value' => $storeUser.phone,'require' => 'phone'],['lable' => '密码错误次数','name' => 'error','value' => $storeUser.error,'require' => true]]])}}
            {{if condition="!$self"}}
            {{:widget('common/Form/select',['角色','store_role_id',$storeUser.store_role_id,$storeRoleSelect])}}
            {{:widget('common/Form/select',['修改密码','is_update_pw',$storeUser.is_update_pw,$storeIsUpPassSelect])}}
            {{:widget('common/Form/select',['状态','status',$storeUser.status,$storeStatusSelect])}}
            {{:widget('common/Form/textarea',['备注','memo',$storeUser.memo,false])}}
            {{else /}}
            <input type="hidden" name="_self" value="true">
            {{/if}}
            {{:widget('common/Form/submit')}}
        </form>
    </div>
</div>
</body>
<script>
    layui.use(['form','jquery'], function(){
        var form = layui.form;
        var $ = layui.jquery;
        var self = $("input[name=_self]");
        //监听提交
        form.on('submit(submitForm)', function(data){
            ajaxRequest('',data.field,function (res) {
                if(res.code == 200){
                    if(window == window.parent){
                        top.location.href = "{{:url('Index/index')}}";
                    }
                    if(!self.length){
                        xadmin.father_reload(); // 可以对父窗口进行刷新
                    }else{
                        xadmin.close();//关闭当前frame
                    }
                }else{
                    layerMsg(res.msg)
                }
            })
            return false;
        });
    });
</script>
